package thread_ex;

public class MyThread implements Runnable {
	
	public void run(){
		try{
			while (!Thread.currentThread().isInterrupted()){
				System.out.println("T스레드 실행중");
				Thread.sleep(1000);
			}
		}catch(InterruptedException ie){
			
		}finally{
			System.out.println("스레드가 종료되었습니다.");
		}
	}
	
	public static void main(String[] args) {
		MyThread mt = new MyThread();
		Thread th = new Thread(mt);
		th.start();
		try{
			Thread.sleep(2500);
		}catch(InterruptedException ie){
			ie.printStackTrace();
		}
		
		th.interrupt();

	}

}
